package com.tt.job.manage.controller;

import com.tt.job.JobInfo;
import com.tt.job.manage.dto.Response;
import com.tt.job.service.JobEventProduceService;
import com.tt.job.zookeeper.ZookeeperRegistryCenter;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@RestController
@RequestMapping("/job")
public class JobManageController {
    @Autowired
    JobEventProduceService produceService;
    @Autowired
    ZookeeperRegistryCenter registryCenter;

    /**
     * 获取所有的Job列表
     */
    @RequestMapping("/list")
    public Response<Map<String, JobInfo>> getSchedules() {
        Map<String, JobInfo> jobLists = registryCenter.getJobs();
        return new Response<>(jobLists);
    }
}
